How can the Media Library be moved?
Prev Next Author: John West
Posted: 8/4/2006 4:53:02 PM
The following applies to Sitecore 5.1 and 5.2 only. When files are uploaded to Sitecore’s Media Library, Sitecore maintains metadata about the files and stores the data to a folder structure under the directory specified by the MediaFolder setting in /web.config (/upload by default). Certain Computer Associates client security products block browser access to files in this directory on servers, requiring media to be placed in an alternate directory. The process below can be used to move a Sitecore Media Library after data has already been uploaded. Note that all versions of all items may be updated.
- Run the following in each of the master, archive and recycle bin databases:
select max( len( convert( varchar( 8000 ), value ))) from fields where value like '%/upload/%';
If this query returns 8000 in any database, that database cannot be corrected with the SQL solution described below. This is most likely to affect the archive and recycle bin databases - items in such databases can be corrected manually after restoration as needed. - Stop IIS.
- Backup Sitecore databases and file systems.
- Rename the /upload folder (for instance to /newpath).
- Change the MediaFolder setting in /web.config (for instance to /newpath).
- Run the equivalent of the following code in the master, web, archive and recycle bin databases (replace /newpath/ as appropriate):
update fields
set value = replace( convert( varchar( 8000 ), value ), '/upload/', '/newpath/' )
where value like '%/upload/%'
- Restart IIS.
- Republish in all languages.
Prev Next